Documentation > CMS Template API Library > Asset > SaveMeta(Dictionary[String,String])

SaveMeta

Saves either the asset's indexer or the meta data fields provided in a dictionary to the database as this asset's meta data fields. If any of the values in the fieldsToStore dictionary are null, they will be stored as an empty string.

public System.Void SaveMeta(Dictionary[String,String])

Parameters

NameDescriptionType
fieldsToStore Optional: If not null, the fields to store. Otherwise the asset's indexer dictionary will be saved. Dictionary<String,String>

Code Example

C#

Sample:
asset.Meta["foo"] = "bar";
asset.Meta["Hamlet"] = "Shakespeare";
asset.SaveMeta();

Dictionary<string, string> fields = new Dictionary<string, string>();
fieldsToStore.Add("foo", "bar");
fieldsToStore.Add("Hamlet", "Shakespeare");
asset.SaveMeta(fieldsToStore);

Connect with Crownpeak